package com.buttonpay.home;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import com.buttonpay.R;

public class ComingSoon extends Activity 
{
	Button btnLogout,btnBack;
	TextView tveaderText;
	String PARENT;
	public void onCreate(Bundle savedInstanceState) 
	{
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tab);
        
        
        /*if(getIntent().getExtras().containsKey("parent"))
        {
        	PARENT=getIntent().getExtras().getString("parent");
        	System.out.println("Parent:"+PARENT);
        }
        */
        btnLogout=(Button)findViewById(R.id.btnLogout);
        btnBack=(Button)findViewById(R.id.btnPrevious);
        tveaderText=(TextView)findViewById(R.id.tv_headerText);
        
        tveaderText.setVisibility(TextView.INVISIBLE);
        
        btnLogout.setOnClickListener(new OnClickListener()
        {
        	
        	public void onClick(View arg0) 
			{
        		new AlertDialog.Builder(ComingSoon.this)
		        .setTitle( "Exit Application" )
		        .setMessage( "Are you sure you want to Logout?" )
		        .setPositiveButton("YES", new android.content.DialogInterface.OnClickListener() 
		        {
		            public void onClick(DialogInterface arg0, int arg1) 
		            {
		                //do stuff onclick of YES
		            	setResult(2);
		            	finish();
		            }

					public void onClick(View v) 
					{
						// TODO Auto-generated method stub
						
					}
		        })
		        .setNegativeButton("NO",  new android.content.DialogInterface.OnClickListener() 
		        {
		            public void onClick(DialogInterface arg0, int arg1)
		            {
		                //do stuff onclick of CANCEL
		            	arg0.dismiss();
		               
		            }

					public void onClick(View v) 
					{
						// TODO Auto-generated method stub
					}
		        }).show();
				// TODO Auto-generated method stub
				  
			}
        	
		});
        
        btnBack.setOnClickListener(new OnClickListener()
        {
			public void onClick(View v) 
			{
				// TODO Auto-generated method stub
				finish();
			}
		});
	}

	@Override
	public void onBackPressed() 
	{
		// TODO Auto-generated method stub
		
		if(PARENT.equalsIgnoreCase("home"))
		{
			finish();
		}
		else
		{
			new AlertDialog.Builder(ComingSoon.this)
		    .setTitle( "Exit Application." )
		    .setMessage( "Are you sure you want to Exit ?" )
		    .setPositiveButton("YES", new android.content.DialogInterface.OnClickListener() 
		    {
		        public void onClick(DialogInterface arg0, int arg1) 
		        {
		            //do stuff onclick of YES
		        	finish();
		        }
		        
				public void onClick(View v) 
				{
					// TODO Auto-generated method stub
					
				}
				
		    })
		    .setNegativeButton("NO",  new android.content.DialogInterface.OnClickListener()
		    {
		    	public void onClick(DialogInterface arg0, int arg1)
		        {
		            //do stuff onclick of CANCEL
		        	arg0.dismiss();
		        }
		
				public void onClick(View v) 
				{
					// TODO Auto-generated method stub
				}
		    }).show();
		}
	}
		
}
